/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package configuraciones;

import org.cip.esymons.general.bc.*;
import org.cip.esymons.general.be.Modulo;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 * @author Lizardo Rios
 */
public class ModuloDelegate {
    public ModuloFacadeLocal local;

    public ModuloDelegate() {
        local=lookupModuloFacade();
    }
    public void create(Modulo modulo) {
        local.create(modulo);
    }

    public void edit(Modulo modulo) {
        local.edit(modulo);
    }

    public void remove(Modulo modulo) {
        local.remove(modulo);
    }

    public Modulo find(Object id) {
        return local.find(id);
    }

    public List<Modulo> findAll() {
        return local.findAll();
    }

    public Modulo buscarXCodigo(Integer modCodigo) {
        return local.buscarXCodigo(modCodigo);
    }

    public List<Modulo> listarModulos() {
        return local.listarModulos();
    }

    private ModuloFacadeLocal lookupModuloFacade() {
        try {
            Context c = new InitialContext();
            return (ModuloFacadeLocal) c.lookup("java:comp/env/ModuloFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }

   
    


}
